/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.java.Mail;

/**
 *
 * @author Administrator
 */
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class SendHTMLEmail
{
   public static void main(String [] args)
   {
      
      final String username = "prajja1990@gmail.com";
final String password = "amma2468524685";

Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "465");

Session session = Session.getInstance(props,
        new javax.mail.Authenticator() {
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(username, password);
            }
        });

try {

    Message message = new MimeMessage(session);
    message.setFrom(new InternetAddress("prajja1990@gmail.com"));
    message.setRecipients(Message.RecipientType.TO,
            InternetAddress.parse("zeconsjavateam@gmail.com"));
    message.setSubject("Test Subject");
     message.setContent("  <table border='2'>\n" +
"  <tr> \n" +
"     <td>Leave Applied By :</td>\n" +
"           <td></td>\n" +
"  </tr>\n" +
"    <tr>\n" +
"        <td>Roll No :</td>\n" +
"           <td></td>\n" +
"   </tr>\n" +
"   <tr>\n" +
"        <td>Leave Type :</td>\n" +
"           <td></td>\n" +
"   </tr>\n" +
"   <tr>\n" +
"        <td>Leave Days :</td>\n" +
"           <td></td>\n" +
"   </tr>\n" +
"   <tr>\n" +
"        <td>Leave Period :</td>\n" +
"           <td></td>\n" +
"   </tr>\n" +
"   <tr>\n" +
"        <td>Reason :</td>\n" +
"           <td></td>\n" +
"   </tr>\n" +
"</table>",
                            "text/html" );
    
   // System.out.println("I am using");
    System.out.println("Why u want to use");
    Transport.send(message);

    System.out.println("Done");
    

} catch (MessagingException e) {
    throw new RuntimeException(e);
}
   }
}
